import { request } from '@/utils/request';

// 获取字典
const getDictionaryData = async (data: any) => await request('/api/dictionary', { method: 'POST', data });

// 公共查询
const fetchCommonListData = async ({ interFaceurl, params }: any) => {
  const res = await request(interFaceurl, { method: 'POST', data: params });
  return res ? { ...res } : false;
};

// 新增/编辑
const fetchCommonUpdateData = async ({ interFaceurl, params }: any) => {
  const res = await request(interFaceurl, { method: 'POST', data: params });
  return res ? { ...res } : false;
};

// 删除
const fetchCommonDeleteData = async ({ interFaceurl, params }: any) => {
  const res = await request(interFaceurl, { method: 'POST', data: params });
  return res ? { ...res } : false;
};

export default {
  getDictionaryData,
  fetchCommonListData,
  fetchCommonUpdateData,
  fetchCommonDeleteData,
};
